home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: usenet.eel.ufl.edu!warwick!bsmail!talisker!nathan
- From: nathan@pact.srf.ac.uk (Nathan Sidwell)
- Subject: Re: Poor floating point code in BC++
- Message-ID: <DKnMHr.IqA@uns.bris.ac.uk>
- Sender: usenet@uns.bris.ac.uk (Usenet news owner)
- Nntp-Posting-Host: talisker.pact.srf.ac.uk
- Organization: Inmos
- X-Newsreader: TIN [version 1.2 PL2]
- References: <4ca5bk$ff@fountain.mindlink.net> <4cc09j$6fm$1@mhafc.production.compuserve.com>
- Date: Thu, 4 Jan 1996 11:27:27 GMT
-
- Dave Hand (70621.3624@CompuServe.COM) wrote:
- : > That there is a function call is no surprise. X is
- : float and n
- : > is int. A conversion is necessary. From the name, that looks
- : like what the routine called does.
-
- : No, all that is necessary is the fistp instruction. The
- : coprocessor has a special instruction to convert a float or
- : double to an int.
-
- Not necessarily, as I pointed out in a previous post, a fistp is insufficent
- if the rounding mode is unknown, or known not to be round to zero.
- Conversion of a float to an int must produce the value closer to zero
- (because the standard says so).
- Such a restriction is not required for other floating point arithmetic,
- because the C standard does not say anything about rounding.
-
- Many C systems permit the rounding mode to be set by a call, it appears
- that borland C is one such system.
-
- nathan
-
- --
- Nathan Sidwell Holder of the Xmris home page
- Chameleon Architecture Group at SGS-Thomson, formerly Inmos
- http://www.pact.srf.ac.uk/~nathan/ Tel 0117 9707182
- nathan@inmos.co.uk or nathan@bristol.st.com or nathan@pact.srf.ac.uk
- Having problems? try http://www.pact.srf.ac.uk/~nathan/problems/
-